package de.kum.utilities;

import java.util.List;

import de.kum.fragments.DHDroidFragments;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/** 
 * Speichert alle Fragments der App.
 */

public class DHDroidFragmentManager extends FragmentPagerAdapter {
	private List<Fragment> Fragments;

	public DHDroidFragmentManager(FragmentManager fm, List<Fragment> fragments) {
		super(fm);
		this.Fragments = fragments;
	}

	/** 
	 * Liefert das aktuelle Fragment.
	 */
	public Fragment getItem(int position) {
		return this.Fragments.get(position);
	}
	
	/** 
	 * Liefert die Anzahl der Fragments.
	 */
	public int getCount() {
		return this.Fragments.size();
	}

	/** 
	 * Liefert den Titel des Fragments
	 */
	public CharSequence getPageTitle(int position) {
		DHDroidFragments fragment = (DHDroidFragments) this.Fragments
				.get(position);
		return fragment.getTabTitle();
	}
}
